<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../../../inc/conn.asp"-->
<!--#include file="../common/u.asp"-->
<%
links="package"

'分页-------------------------------------------------------
set Rs=server.CreateObject("ADODB.RecordSet")
sql="select count(sortid) from (Select ROW_NUMBER() OVER (order by id desc) as sortid,* From View_Package) as TempTable where 1=1 and isPackage=0 and uid='"&uid&"'"
Pager_Pagesize=10 '每页记录数
Rs.open sql,conn,1,1
Pager_TotalRecord=Rs(0) '总记录数
Rs.close
Pager_PageCount=int((Pager_TotalRecord/Pager_Pagesize)+0.99999) '计算总页数
CurrentPage=Request("page") '当前页
if CurrentPage=0 then CurrentPage=1
'如果不为数字则直接设置页码为1
if isnumeric(CurrentPage)=False Or CurrentPage="" then
	CurrentPage=1
'如果当前页数大于总页数，则直接设置页码为1
elseif  Clng(CurrentPage)>Pager_PageCount then
	CurrentPage=1
end if
Fieldsname="  id, uid, url, title, WarehouseTime,Qty, Weight, mark, isPackage,typeid,sortid"
orderBy=" Order by sortid asc"
'拆分SQL语句，必须是select开头，有唯一标识的列
if instr("select",sql)<>-1 then
	if CurrentPage = 1 then
		sql = replace(sql,"select count(sortid)"," select  top " & Pager_Pagesize  & Fieldsname)
	else  
		sql = replace(sql,"select count(sortid)"," select  top " & Pager_Pagesize   & Fieldsname) & " and sortid >(select max(sortid) from (" & replace(sql,"select count(sortid)"," select  top " & Pager_Pagesize * (CurrentPage - 1)  & Fieldsname) & orderBy & ") AA)"
	end if
end if
sql = sql & orderBy
Rs.open sql,conn,1,1
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>包裹管理</title>
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<link rel="stylesheet" type="text/css" href="/css/reveal.css">	
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.tabs.js"></script>
<script type="text/javascript" src="/js/jquery.reveal.js"></script>
<script type="text/javascript">
//$(function(){
//	$('.reg_s_1').Tabs({
//		event:'click'
//	});
//});	

</script>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var checkflag = "false";
function checkall(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";}
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";	}
}
//end-->
</script>
</head>
<body>


<!--#include file="../../common/top.asp"-->





<div class="fullwidth">
	<div class="place ">
		<a href="/">首页</a> &gt; <a href="/user">会员中心</a> &gt; 包裹管理
	</div>
</div>
<!--main-->
<div class="fullwidth bg1">
	<div class="main">
		
		
        
        <!--#include file="../common/left.asp"-->
        
        
		
		<div class="right_show f_r">
			
			<div class="title_4">
				<h2>包裹管理</h2><div></div>
			</div>
			<div class="reg_box reg_s_1 account order_tab order_tab1">
				<ul class="tab_menu">
					<li class="current"><a href="/user/package">我的仓库</a></li>
					<li><a href="/user/package/notpay">未付款包裹</a></li>
					<li><a href="/user/package/order/1">未发送包裹</a></li>
					<li><a href="/user/package/order/2">已发送包裹</a></li>
					<li><a href="/user/package/order/3">交易成功</a></li>
				</ul>
				<div class="tab_box">
					<div>
					<form name="formreg" method="post" action="" onSubmit="return myjobchk();">
                    	<p class="tip tip_3">※我的仓库显示的是所有在库的，未加入包裹的商品。请选择商品<a onclick="formreg.submit()" href="javascript:;" class="btn_11">加入包裹</a></p>
						<table class="stable stable_1 stable_2">
							<tr>
								<th><input type="checkbox" onClick="javascript:checkall(this.form);" /> 全选</th>
								<th>商品名称</th>
								<th>数量</th>
								<th>重量</th>
								<th>入库日期</th>
							</tr>
							
                            
                            <%do while not Rs.eof%>
                            <tr>
								<td><input type="checkbox" name="id" value="<%=rs("id")%>" /><input type="hidden" name="typeid<%=rs("id")%>" value="<%=rs("typeid")%>" /></td>
								<td title="<%=rs("title")%>"><%=left(rs("title"),15)%></td>
								<td><%=rs("qty")%></td>
								<td><%=rs("weight")%>克</td>
								<td><%=rs("WarehouseTime")%></td>
							</tr>
                            <%
							Rs.movenext
							loop
							Rs.close
							Set Rs=nothing
							%>
                            
                            
                            
							
						</table>
			      <div class="clear20"></div>
						<div class="clear20"></div>
						<div class="clear20"></div>
						<div class="page">
							
                          <%
							if CurrentPage<=1 then
							pageview="<a><</a>"
							else
							pageview="<a href='/user/package?page="&CurrentPage-1&"'><</a>"
							end if
							for tp = -10 to 9
							if Pager_PageCount>=tp+page and tp+page=>1  then 
							if trim(tp+page)=trim(request("page")) then
							pageview=pageview+"<a class='cur_page'>"&tp+page&"</a>"
							else
							pageview=pageview+"<a href='/user/package?page="&tp+page&"'>"&tp+page&"</a>"
							end if
							end if
							next
							if Pager_PageCount<CurrentPage+1 then
							pageview=pageview+"<a>></a>"
							else
							pageview=pageview+"<a href='/user/package?page="&CurrentPage+1&"'>></a>"
							end if
							response.Write pageview
							%>
                            
                            
				    </div>
						<div class="clear20"></div>

						<div class="clear20"></div>
                        <input type="hidden" name="t" value="yes" />
					</form>
                    </div>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
					
					
                    
                    
                    
                    
                    
                    
                    
					
					
                    
                    
                    
                    
                    
                    
                    
					
                    
                    
                    
                    
                    
                    
                    
                    
					
                    
                    
                    
					
										
				</div>
				<div class="clear20"></div>
				<div class="clear20"></div>
			</div>	
			
		</div>
		
		
	</div>
</div>

<div class="clear"></div>

<!--#include file="../../common/footer.asp"-->



<%

if request.Form("t")="yes" then
  id=checkstr(inHTML(request.Form("id")))
  
  if id="" then
  response.Write "<div class=""pop_content"">请选择商品 <a href=""javascript:history.back(-1)"">返回</a></div><div class=""pop_bg""></div>"
  response.end
  end if
  
  checkbox=split(replace(id," ",""),",")
  for i=0 to ubound(checkbox)
	 if request.Form("typeid"&checkbox(i))="1" then
	   conn.execute("update AuctionsOrder set isPackage=1 where uid='"&uid&"' and id = "&checkbox(i)&"")
	 else
	   conn.execute("update OrderDetail set isPackage=1 where uid='"&uid&"' and id = "&checkbox(i)&"")
	 end if
  next
  
  response.Write "<div class=""pop_content"">加入成功<br> <a href='/user/package/notpay'>查看已加入商品</a> &nbsp; <a href='/user/package?page="&CurrentPage&"'>继续添加商品</a></div><div class=""pop_bg""></div>"
end if
%>


</body>
</html>